export const SEARCH_FORM = "SEARCH_FORM"
export const CATEGORY = "TASK_CATEGORY"

const defaultForm = {
    type: SEARCH_FORM,
    params: {
        Id: 0,
        Desc: "",
        FuncName: ""
    }
}
const defaultCategory = {
    type: CATEGORY,
    params: []
}

export function AddSearchForm(params) {
    return {
        type: SEARCH_FORM,
        params
    }
}

export function TaskSearchFormReducer(state = defaultForm, action) {
    let newState = Object.assign({}, state)
    switch (action.type) {
        case SEARCH_FORM:
            newState.params = action.params
            return newState
    }
    return newState
}

export function SetCateGoryList(params){
    return {
        type:CATEGORY,
        params
    }
}
export function TaskCateGoryListReducer(state = defaultCategory, action) {
    let newState = Object.assign({}, state)
    switch (action.type) {
        case CATEGORY:
            newState.params = action.params
            return newState
    }
    return newState
}
